<?php

namespace app\controller;

use support\Request;
use app\model\BlogCategory;
use app\model\BlogArticle;

class IndexController
{
    public function index(Request $request)
    {
        $cates = BlogCategory::select(['id', 'name'])->get()->toArray();
        $articles = BlogArticle::select(['id', 'title', 'description', 'istop', 'cate_id', 'cate_name', 'created_at'])
            ->orderBy('created_at', 'desc')->limit(10)->get()->toArray();
        return view('index/index', ['cates' => $cates, 'articles' => $articles]);
    }


    public function about(Request $request)
    {
        return view('index/about');
    }
}